import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/* eslint-disable */

/**
 * service - 工作台配置
 * @date: 2018-9-25
 * @version: 1.0.0


 */
import request from "../utils/request";
import { getEnvConfig } from "../utils/iocUtils";
import { isTenantRoleLevel, getCurrentOrganizationId } from "../utils/utils";

var _getEnvConfig = getEnvConfig(),
    CPAAS_PLATFORM = _getEnvConfig.CPAAS_PLATFORM;
/**
 * 请求API前缀
 * @type {string}
 */


var prefix = "".concat(CPAAS_PLATFORM, "/v1");
/**
 * 查询当前布局
 * @param {Object} params - 查询参数
 */

export function workplaceLayoutQuery(_x) {
  return _workplaceLayoutQuery.apply(this, arguments);
}
/**
 * 保存当前布局
 * @param {Object} params - 需保存的数据
 */

function _workplaceLayoutQuery() {
  _workplaceLayoutQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", request("".concat(prefix, "/dashboard/layout"), {
              method: 'GET',
              query: params
            }));

          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _workplaceLayoutQuery.apply(this, arguments);
}

export function workplaceLayoutUpdate(_x2) {
  return _workplaceLayoutUpdate.apply(this, arguments);
}
/**
 * 查询当前角色 所有的卡片
 */

function _workplaceLayoutUpdate() {
  _workplaceLayoutUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(prefix, "/dashboard/layout"), {
              method: 'POST',
              body: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _workplaceLayoutUpdate.apply(this, arguments);
}

export function workplaceCardsQuery(_x3) {
  return _workplaceCardsQuery.apply(this, arguments);
}

function _workplaceCardsQuery() {
  _workplaceCardsQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
    return _regeneratorRuntime.wrap(function _callee3$(_context3) {
      while (1) {
        switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", request("".concat(prefix, "/dashboard/layout/role-cards"), {
              method: 'GET',
              query: params
            }));

          case 1:
          case "end":
            return _context3.stop();
        }
      }
    }, _callee3);
  }));
  return _workplaceCardsQuery.apply(this, arguments);
}